package com.gmall.rabbitmq.producer.controller;

import com.gmall.rabbitmq.config.RabbitMQConfig_Topic;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("topic")
public class TopicExchangeController {

    @Autowired
    RabbitTemplate rabbitTemplate;
    @GetMapping("string/{routingKey}")
    public String producerMessage(@PathVariable String routingKey){

        rabbitTemplate.convertAndSend(RabbitMQConfig_Topic.Exchange_Topic_1,
                routingKey,"Hello 2109A");

        return "OK";
    }

}
